var vm = new Vue({
	el: '#app',
	data: {
		items: [],
		loaded: false
	},
	mounted: function() {
		$("#line").pullToRefresh().on("pull-to-refresh", function() {
			$.showLoading();
			setTimeout(function() {
				$("#line").pullToRefreshDone();
				index();
				$.toptip('刷新数据成功', 'success');
			}, 500);
		});
		index();
	}
});
/**
 * 首页信息
 */
function index() {
	$.ajax({
		type: "GET",
		url: ip + "trade/finance/serverGetUserAccountList.o",
		xhrFields: {
			withCredentials: true
		},
		cache:false,
		crossDomain: true,
		success: function(data) {
			if(data.statusCode == 0) {
				vm.loaded = true;
				$.showLoading();
				setTimeout(function() {
					$.hideLoading();
				}, 100);
				vm.items = data.result;
				localStorage.setItem('content', JSON.stringify(data.result[0]));
			} else if(data.statusCode == 1000) {
				$.toptip("登录失效！", 'error');
				setTimeout('window.location.href = "signIn.html"', 1000);
			} else {
				$.toptip(data.resultDesc, 'error');
			}
		}
	});
}

/**
 * 转账的数据
 */
function setTransferAccounts(content) {
	if(content.tradeCoin.name == "HMS") {
		setTimeout('window.location.href = "HMSAdministration.html"', 100);
	} else {
		return false;
	}
}